package com.upcoming.data.storm.reliablesend;

import org.apache.storm.Config;
import org.apache.storm.LocalCluster;
import org.apache.storm.topology.TopologyBuilder;

import java.util.HashMap;
import java.util.Map;

/**
 * 作者：tianjiayuan
 * 创建时间：2018-05-18 15:18
 * 类描述：
 * 修改人：
 * 修改时间：
 */
// main  com.upcoming.data.storm.reliablesend.APP
public class APP {

    public static void main(String[] args) throws Exception{
        //配置信息
        Config conf = new Config();
        conf.setDebug(false);
//        conf.setNumWorkers(3);
        Map<String, String> map = new HashMap<>();
//        map.put("storm.zookeeper.servers", "127.0.0.1");
        conf.setEnvironment(map);

//        conf.setMessageTimeoutSecs(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS);

        TopologyBuilder builder = new TopologyBuilder();
        //设置水龙头
        builder.setSpout("myspout", new MySpout(), 1).setNumTasks(3);
        builder.setBolt("mybolt", new MyBolt(), 2).setNumTasks(6).shuffleGrouping("myspout");
        //运行本地集群模式
        LocalCluster localCluster = new LocalCluster();
        //向集群中提交Topology
        localCluster.submitTopology("ReliableAPP", conf, builder.createTopology());
        Thread.sleep(1000*60);
        localCluster.shutdown();

//        StormSubmitter.submitTopology("ReliableAPP", conf, builder.createTopology());
    }
}
